module.exports = async (ctx, next) => {
  try {
    await next()
  } catch (error) {
    const message = error.message || '未知错误'
    const status = error.status || 500
    ctx.status = error.status || 500
    ctx.body = {
      status: status,
      message: message
    }
  }
}